﻿namespace DBUtil.Provider.Sqlite;

/// <summary>
/// Sqlite 数据库工厂类
/// </summary>
public class SqliteDBFactory : IDBFactory<SqliteAccess>
{
    /// <summary>
    /// 创建数据库操作对象
    /// </summary>
    /// <param name="DBConn">连接字符串</param>
    /// <param name="Settings">设置</param>
    /// <returns></returns>
    public static SqliteAccess CreateIDB(string DBConn, DBSetting Settings)
    {
        return new SqliteAccess(DBConn, Settings);
    }

    /// <summary>
    /// 创建数据库操作对象
    /// </summary>
    /// <param name="DBType">数据库类型:Sqlite</param>
    /// <param name="DBConn">连接字符串:Server=localhost;Port=5432;UserId=postgres;Password=123456;Database=test;</param>
    /// <param name="Settings">设置</param>
    /// <returns></returns>
    public SqliteAccess CreateDB(string DBType, string DBConn, DBSetting Settings)
    {
        DBType = (DBType ?? "").ToUpper();
        switch (DBType)
        {
            case Consts.ServerType:
                {
                    return CreateIDB(DBConn, Settings);
                }
            default:
                {
                    return null;
                }
        }
    }
}
